package com.enjoyor.soa.traffic.core.efoms.helper;

import com.enjoyor.soa.traffic.core.efoms.domain.DeviceStatusInfo;
import com.enjoyor.soa.traffic.core.efoms.domain.RepairsRecordInfo;
import com.enjoyor.soa.traffic.core.efoms.enums.EnumDicPublic;
import com.enjoyor.soa.traffic.util.helper.TimeHelper;

public class GetObjectHelper {

	public static RepairsRecordInfo getRepairsRecordInfo(String Flag,String operExplain,String userName,String repairsId){
		RepairsRecordInfo repairsRecordInfo = new RepairsRecordInfo();
		if(Flag.equals("AUDIT")){
			repairsRecordInfo.setRepRecordId(TimeHelper.getUniqueString());
			repairsRecordInfo.setOperateDate(TimeHelper.dateToLongString());
			repairsRecordInfo.setOperExplain(operExplain);
			repairsRecordInfo.setOperPerson(userName);
			repairsRecordInfo.setOperReasonCode(EnumDicPublic.REP_CHECKPASS.getKey());
			repairsRecordInfo.setOperReasonName(EnumDicPublic.REP_CHECKPASS.getValue());
			repairsRecordInfo.setOperTypeCode(EnumDicPublic.REP_OPER_CHECK.getKey());
			repairsRecordInfo.setOperTypeName(EnumDicPublic.REP_OPER_CHECK.getValue());
			repairsRecordInfo.setOperResultCode(EnumDicPublic.OPER_CHECKPASS.getKey());
			repairsRecordInfo.setOperResult(EnumDicPublic.OPER_CHECKPASS.getValue());
			repairsRecordInfo.setRepairsId(repairsId);
		}else if(Flag.equals("CANCEL")){
			repairsRecordInfo.setRepRecordId(TimeHelper.getUniqueString());
			repairsRecordInfo.setOperateDate(TimeHelper.dateToLongString());
			repairsRecordInfo.setOperExplain(operExplain);
			repairsRecordInfo.setOperPerson(userName);
			repairsRecordInfo.setOperReasonCode(EnumDicPublic.REP_CHECKPASS.getKey());
			repairsRecordInfo.setOperReasonName(EnumDicPublic.REP_CHECKPASS.getValue());
			repairsRecordInfo.setOperTypeCode(EnumDicPublic.REP_OPER_DELETE.getKey());
			repairsRecordInfo.setOperTypeName(EnumDicPublic.REP_OPER_DELETE.getValue());
			repairsRecordInfo.setRepairsId(repairsId);
		}else if(Flag.equals("PRESS")){
			repairsRecordInfo.setRepRecordId(TimeHelper.getUniqueString());
			repairsRecordInfo.setOperateDate(TimeHelper.dateToLongString());
			repairsRecordInfo.setOperExplain(operExplain);
			repairsRecordInfo.setOperPerson(userName);
			repairsRecordInfo.setOperTypeCode(EnumDicPublic.REP_OPER_PRESS.getKey());
			repairsRecordInfo.setOperTypeName(EnumDicPublic.REP_OPER_PRESS.getValue());
			repairsRecordInfo.setRepairsId(repairsId);
		}
		return repairsRecordInfo;
	}
	
	/**
	 * get设备状态pojo(用于报修单生成之后改变设备状态)
	 */
	public static DeviceStatusInfo getDevStatusInfo(String devId){
		DeviceStatusInfo deviceStatusInfo = new DeviceStatusInfo();
		deviceStatusInfo.setDevId(devId);
        deviceStatusInfo.setDevStatusCode(EnumDicPublic.DEVICE_STATUS_FAILURE.getKey());
        deviceStatusInfo.setDevStatusName(EnumDicPublic.DEVICE_STATUS_FAILURE.getValue());
		return deviceStatusInfo;
	}
	
	/**
     * 根据维修工单状态编号获取状态名称
     * @return
     */
	public static String getNameByStatusCode(String statusCode) {
    	String statusName = null;
    	if(EnumDicPublic.ORD_WAITDISPATCH.getKey().equals(statusCode)) {
    		statusName = EnumDicPublic.ORD_WAITDISPATCH.getValue();
    	}else if(EnumDicPublic.ORD_WAITREPAIR.getKey().equals(statusCode)) {
    		statusName = EnumDicPublic.ORD_WAITREPAIR.getValue();
    	}else if(EnumDicPublic.ORD_WAITSURE.getKey().equals(statusCode)) {
    		statusName = EnumDicPublic.ORD_WAITSURE.getValue();
    	}else if(EnumDicPublic.ORD_WAITAGAINSURE.getKey().equals(statusCode)) {
    		statusName = EnumDicPublic.ORD_WAITAGAINSURE.getValue();
    	}else if(EnumDicPublic.ORD_ISREJECT.getKey().equals(statusCode)) {
    		statusName = EnumDicPublic.ORD_ISREJECT.getValue();
    	}else if(EnumDicPublic.ORD_WAITEVALUATE.getKey().equals(statusCode)) {
    		statusName = EnumDicPublic.ORD_WAITEVALUATE.getValue();
    	}else if(EnumDicPublic.ORD_ISFINISH.getKey().equals(statusCode)) {
    		statusName = EnumDicPublic.ORD_ISFINISH.getValue();
    	}else if(EnumDicPublic.ORD_ISDELETE.getKey().equals(statusCode)) {
    		statusName = EnumDicPublic.ORD_ISDELETE.getValue();
    	}
    	return statusName;
    }
	
	/**
     * 根据类别编号获取类别名称
     * @return
     */
	public static String getNameByCategoryCode(String categoryCode) {
    	String categoryName = null;
    	if(EnumDicPublic.DEV_CATEGORY.getKey().equals(categoryCode)) {
    		categoryName = EnumDicPublic.DEV_CATEGORY.getValue();
    	}else if(EnumDicPublic.INS_CATEGORY.getKey().equals(categoryCode)) {
    		categoryName = EnumDicPublic.INS_CATEGORY.getValue();
    	}
    	return categoryName;
    }
	/**
     * 根据类型编号获取类型名称
     * @return
     */
	public static String getNameByTypeCode(String typeCode) {
    	String typeName = null;
    	if(EnumDicPublic.SEMAPHORE.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.SEMAPHORE.getValue();
    	}else if(EnumDicPublic.VIDEO.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.VIDEO.getValue();
    	}else if(EnumDicPublic.ELEPOLICE.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.ELEPOLICE.getValue();
    	}else if(EnumDicPublic.FASTENER.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.FASTENER.getValue();
    	}else if(EnumDicPublic.MAGNETISM.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.MAGNETISM.getValue();
    	}else if(EnumDicPublic.WINDING.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.WINDING.getValue();
    	}else if(EnumDicPublic.WAVELET.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.WAVELET.getValue();
    	}else if(EnumDicPublic.INSCREEN.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.INSCREEN.getValue();
    	}else if(EnumDicPublic.TIDEROADWAYPILOT.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.TIDEROADWAYPILOT.getValue();
    	}else if(EnumDicPublic.CHANROADWAYPILOT.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.CHANROADWAYPILOT.getValue();
    	}else if(EnumDicPublic.RAMPPILOT.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.RAMPPILOT.getValue();
    	}else if(EnumDicPublic.VIDEOCHECK.getKey().equals(typeCode)) {
    		typeName = EnumDicPublic.VIDEOCHECK.getValue();
    	}
    	return typeName;
    }
}
